package com.trussell.genesis.windowutils.menus;

import java.awt.event.InputEvent;

import javax.swing.ImageIcon;
import javax.swing.JMenu;
import javax.swing.JMenuItem;
import javax.swing.KeyStroke;

/**
 * This class helps reduce the number of lines of code
 * in Genesis.java by taking the GUI and controller 
 * construction of the Edit menu and placing it into
 * this class.
 * @author Tyler Trussell
 */
public class EditMenu extends JMenu {
	
	private static final long serialVersionUID = 1L;

	/**
	 * Returns a GenesisEditMenu, which contains the prepared
	 * JMenuItems necessary. They have already been bound to
	 * listeners.
	 */
	public EditMenu() {
		super("Edit");
		
		//TODO: finish adding accelerators
		JMenuItem undo = new JMenuItem("Undo");
		undo.setAccelerator(KeyStroke.getKeyStroke('Z', InputEvent.CTRL_MASK));
		JMenuItem redo = new JMenuItem("Redo");
		redo.setAccelerator(KeyStroke.getKeyStroke('Y', InputEvent.CTRL_MASK));
		JMenuItem cut = new JMenuItem("Cut");
		cut.setAccelerator(KeyStroke.getKeyStroke('X', InputEvent.CTRL_MASK));
		JMenuItem copy = new JMenuItem("Copy");
		copy.setAccelerator(KeyStroke.getKeyStroke('C', InputEvent.CTRL_MASK));
		JMenuItem paste = new JMenuItem("Paste");
		paste.setAccelerator(KeyStroke.getKeyStroke('V', InputEvent.CTRL_MASK));
		JMenuItem delete = new JMenuItem("Delete");
		delete.setAccelerator(KeyStroke.getKeyStroke("DELETE"));
		
		undo.setIcon(new ImageIcon("images/basicicons/Undo16.gif"));
		redo.setIcon(new ImageIcon("images/basicicons/Redo16.gif"));
		cut.setIcon(new ImageIcon("images/basicicons/Cut16.gif"));
		copy.setIcon(new ImageIcon("images/basicicons/Copy16.gif"));
		paste.setIcon(new ImageIcon("images/basicicons/Paste16.gif"));
		delete.setIcon(new ImageIcon("images/basicicons/Delete16.gif"));
		
		add(undo);
		add(redo);
		addSeparator();
		add(cut);
		add(copy);
		add(paste);
		addSeparator();
		add(delete);
	}

}
